package cn.icanci.loopstack.ddk.client.repository;

import java.util.Objects;
import java.util.StringJoiner;

/**
 * @author icanci
 * @since 1.0 Created in 2023/01/14 17:06
 */
public class FieldHolderKey {
    /**
     * key
     */
    private String   key;
    /**
     * 需要映射的类型
     */
    private Class<?> clazz;

    public FieldHolderKey() {
    }

    public FieldHolderKey(String key, Class<?> clazz) {
        this.key = key;
        this.clazz = clazz;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Class<?> getClazz() {
        return clazz;
    }

    public void setClazz(Class<?> clazz) {
        this.clazz = clazz;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        FieldHolderKey that = (FieldHolderKey) o;
        return Objects.equals(key, that.key) && Objects.equals(clazz, that.clazz);
    }

    @Override
    public int hashCode() {
        return Objects.hash(key, clazz);
    }

    @Override
    public String toString() {
        return new StringJoiner(",").add("key=" + key).add("clazz=" + clazz).toString();
    }
}
